const sharp = require('sharp');
const fs = require('fs');

async function changeImageSize(sourcePath, targetPath, width, height) {
  const outputBuffer = await sharp(sourcePath)
    .removeAlpha()
    .resize(width, height)
    .toBuffer();
  fs.writeFileSync(targetPath, outputBuffer);
}

exports = module.exports = {
  changeImageSize
};
